<template>
<div>
  <div class="container">
    <div class="row clearfix">
      <div class="col-md-12 column">
        <div class="jumbotron">
          <center><h1>新闻分类系统
          </h1></center>
          <p>
            新闻发展越来越快，每天各种各样的新闻令人目不暇接，

            对新闻进行科学的分类既能够方便不同的阅读群体根据需求快速选取自身感兴趣的新闻，也能够有效满足对海量的新闻素材提供科学的检索需求。.
          </p>
          <p>
            <a class="btn btn-primary btn-large"><router-link to="/register">注册账号</router-link> </a>
          </p>
        </div>
        <div class="row clearfix">
          <div class="col-md-4 column">
          </div>
          <div class="col-md-4 column">

              <div class="form-group">
                <label for="exampleInputEmail1">账号</label><input type="text" v-model="username" class="form-control" id="exampleInputEmail1" />
              </div>
              <div class="form-group">
                <label for="exampleInputPassword1">密码</label><input type="password" v-model="password" class="form-control" id="exampleInputPassword1" />
              </div>
              <div class="form-group">

              </div>
              <div class="checkbox">
              </div>
              <button  class="btn" v-on:click="login" >登录</button>

          </div>
          <div class="col-md-4 column">
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
</template>


<script>
export default {
  name: "Login",
  data() {
    return{
      username:"",
      password:"",

    }
  },
  methods:{
    login(){
      let _this=this;
      _this.$ajax.post(baseUrl+"user/login",{

          username:_this.username,
          password:_this.password

      }).then((response)=>{
          if (response.data=="success"){
            _this.$router.push("/news")
          }else {
            _this.$router.push("/login")

          }
      })
    }
  }
}
</script>

<style scoped>

</style>